<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of MfXmlParserclass
 *
 * @author krun
 */
class MfXmlParser extends SimpleXMLElement {

	public function __call($name, $convert = true) {
		if (substr($name, 0, 3) == 'Get') {
			$var = strtolower(substr($name, 3, 1)) . substr($name, 4);

			return $this->Prepare($this->$var, $convert);
		}
	}

	public function __get($data) {
		return $this->Prepare(parent::__get($data));
	}

	private function Prepare($txt, $convert = true) {
		if (strlen($txt) > 0) {
			$txt = trim($txt);
		}

		if ($convert) {
			$txt = @iconv('UTF-8', 'ISO-8859-2//TRANSLIT', $txt);
		}

		return $txt;
	}
}
